﻿using System;

namespace CyberConnect.Insteon.Messaging
{
    public abstract class DeviceMessageDecorator
    {
        private readonly DeviceMessage _Message;

        public DeviceMessage Message { get { return _Message; } }

        internal DeviceMessageDecorator(DeviceMessage message)
        {
            if (message == null) { throw new ArgumentNullException("message"); }

            this._Message = message;
        }

        public static implicit operator DeviceMessage(DeviceMessageDecorator decorator)
        {
            return ToDeviceMessage(decorator);
        }

        public static DeviceMessage ToDeviceMessage(DeviceMessageDecorator decorator)
        {
            if (decorator == null) { throw new ArgumentNullException("decorator"); }

            return decorator.Message;
        }
    }
}